var layer = layui.layer //弹层
    ,table = layui.table //表格
    ,form = layui.form,$ = layui.jquery
    ,processId=getQueryVariable("processId")
    ,busskey=getQueryVariable("busskey")
    ,formkey=getQueryVariable("formkey")
    ,taskId=getQueryVariable("taskId")
;


$("#lct")[0].src="process/traceprocess?processId="+processId;
$("#lcyw")[0].src=formkey+"="+busskey;

table.render({
    elem: '#lcrz'
    //,data:data1
    // ,toolbar: '#toolbarDemo'
    ,where:{"taskId":taskId}
    ,typ:"get"
    ,url:"process/getProcessComments"
    ,cols: [[
        // {checkbox: true, fixed: true}
        //{field:'id', width:50, fixed: true, hide:true}
        {field:'userId', title:'审批人',fixed:true,align: 'center', width:120}
        ,{field:'message', title:'审批信息', fixed: true,width:90}
        /*,{field:'code', title:'用户编码', sort: true, width:150}
        ,{field:'roles', title:'角色', fixed: true, width:300}
        ,{field:'right', title:'关联',align: 'center',toolbar:'#usererelevance', width:150}*/
       // ,{fixed: 'right',  align:'center',width:100, toolbar: '#spsearch', title:'操作'}
    ]]
    ,id: 'lcrztableid'
    ,height: $(document).height() - $('#lcrz').offset().top - 50
    ,page: false

});
$("#tj").on("click",function (data) {

    var comment=$("#spyj").val();
    $.ajax({
        type : 'get'
        //  url : 'resource/getTree',
        //String taskId, Map<String, Object> variables, String activityId,String comment
        ,data:{"taskId":taskId,"variables":null,"activityId":null,"comment":comment},
        url:'process/commitProcess',
        dataType:"json",
        /*  contentType: 'application/json',*/
        async:false,
        success : function (da) {
            if(da.status==200 ){
                layer.msg("提交成功");
                //parent.detab("views/jsp/SystemCenter/spdb.jsp");
                parent.detab("views/jsp/SystemCenter/spdb.jsp","待办");
                parent.intab("views/jsp/SystemCenter/sp.jsp")
                parent.detab("views/jsp/SystemCenter/sp.jsp?processId="+processId+"&busskey="+busskey+"&formkey="+formkey+"&taskId="+taskId,"流程处理");
            }
        },
        error: function(data) {
            // layer.msg("获取失败!");
        }
    });
})
$("#bh").on("click",function (data) {
    var comment=$("#spyj").val();
    $.ajax({
        type : 'get'
        //  url : 'resource/getTree',
        //String taskId, Map<String, Object> variables, String activityId,String comment
        ,data:{"taskId":taskId,"variables":null,"comment":comment},
        url:'process/backProcess',
        dataType:"json",
        /*  contentType: 'application/json',*/
        async:false,
        success : function (da) {
            if(da.status==200 ){
                layer.msg("驳回成功");
            }
        },
        error: function(data) {
            // layer.msg("获取失败!");
        }
    });
})
